package com.glueball.crm.module.client.ui;

import com.glueball.crm.module.client.model.Contact;
import com.glueball.crm.module.common.ui.ShowWidget;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

public class ShowContactWidget extends ShowWidget<Contact> {
	
	@UiField Label titulus;
	@UiField Label firstName;
	@UiField Label lastName;
	@UiField Label active;

	private static ShowContactWidgetUiBinder uiBinder = GWT.create(ShowContactWidgetUiBinder.class);

	interface ShowContactWidgetUiBinder extends	UiBinder<Widget, ShowContactWidget> {
	}

	public ShowContactWidget(final Contact contact) {
		this.widget = uiBinder.createAndBindUi(this);
		setEntity(contact);
	}

	@Override
	public void setEntity(final Contact _entity) {
		this.entity = _entity;
		this.titulus.setText(this.entity.getTitulus());
		this.firstName.setText(this.entity.getFirstName());
		this.lastName.setText(this.entity.getLastName());
		this.active.setText(this.entity.isActive()?"Active":"Inactive");
	}
	
}
